using MicroMsg.Network;
using System;
namespace MicroMsg.Scene.Video
{
	public class DownloadVideoContextMgr : ContextMgrBase<DownloadVideoContext>
	{
		private const string TAG = "DownloadVideoContextMgr";
		public static DownloadVideoContextMgr gDownVideoContextMgr;
		public static DownloadVideoContextMgr getInstance()
		{
			if (DownloadVideoContextMgr.gDownVideoContextMgr == null)
			{
				DownloadVideoContextMgr.gDownVideoContextMgr = new DownloadVideoContextMgr();
			}
			return DownloadVideoContextMgr.gDownVideoContextMgr;
		}
		public DownloadVideoContext findBySrvMsgID(int srvMsgID)
		{
			DownloadVideoContext result;
			lock (this.mQueueLock)
			{
				if (this.mContextQueue.isEmpty())
				{
					result = null;
				}
				else
				{
					for (ListNode next = this.mContextQueue._head._next; next != null; next = next._next)
					{
						DownloadVideoContext downloadVideoContext = next._obj as DownloadVideoContext;
						if (downloadVideoContext != null && downloadVideoContext.mVideoInfo.nMsgSvrID == srvMsgID)
						{
							result = downloadVideoContext;
							return result;
						}
					}
					result = null;
				}
			}
			return result;
		}
	}
}
